home *** CD-ROM | disk | FTP | other *** search
/ Erotic Games: Memory / Erotic Games: Memory.iso / mac / air_installers / AdobeAIR.exe / setup.swf / scripts / InstalledAppItemRenderer.as < prev    next >
Text File  |  2009-02-12  |  7KB  |  231 lines

  1. package
  2. {
  3.    import flash.utils.getDefinitionByName;
  4.    import mx.binding.Binding;
  5.    import mx.binding.IBindingClient;
  6.    import mx.binding.IWatcherSetupUtil;
  7.    import mx.containers.Canvas;
  8.    import mx.controls.Image;
  9.    import mx.controls.Label;
  10.    import mx.core.UIComponentDescriptor;
  11.    import mx.core.mx_internal;
  12.    import mx.events.PropertyChangeEvent;
  13.    import mx.skins.ProgrammaticSkin;
  14.    
  15.    use namespace mx_internal;
  16.    
  17.    public class InstalledAppItemRenderer extends Canvas implements IBindingClient
  18.    {
  19.       
  20.       private static var _watcherSetupUtil:IWatcherSetupUtil;
  21.        
  22.       
  23.       private var _437289382defaultIcon:Class;
  24.       
  25.       mx_internal var _bindingsByDestination:Object;
  26.       
  27.       mx_internal var _bindingsBeginWithWord:Object;
  28.       
  29.       private var _1149714771appLabel:Label;
  30.       
  31.       mx_internal var _watchers:Array;
  32.       
  33.       private var _1410965406iconImage:Image;
  34.       
  35.       mx_internal var _bindings:Array;
  36.       
  37.       private var _documentDescriptor_:UIComponentDescriptor;
  38.       
  39.       public function InstalledAppItemRenderer()
  40.       {
  41.          this._documentDescriptor_ = new UIComponentDescriptor({
  42.             "type":Canvas,
  43.             "propertiesFactory":function():Object
  44.             {
  45.                return {
  46.                   "height":20,
  47.                   "childDescriptors":[new UIComponentDescriptor({
  48.                      "type":Image,
  49.                      "id":"iconImage",
  50.                      "stylesFactory":function():void
  51.                      {
  52.                         this.verticalCenter = "0";
  53.                      },
  54.                      "propertiesFactory":function():Object
  55.                      {
  56.                         return {
  57.                            "height":16,
  58.                            "width":16
  59.                         };
  60.                      }
  61.                   }),new UIComponentDescriptor({
  62.                      "type":Label,
  63.                      "id":"appLabel",
  64.                      "stylesFactory":function():void
  65.                      {
  66.                         this.verticalCenter = "1";
  67.                      },
  68.                      "propertiesFactory":function():Object
  69.                      {
  70.                         return {
  71.                            "x":20,
  72.                            "percentWidth":100
  73.                         };
  74.                      }
  75.                   })]
  76.                };
  77.             }
  78.          });
  79.          this._437289382defaultIcon = InstalledAppItemRenderer_defaultIcon;
  80.          this._bindings = [];
  81.          this._watchers = [];
  82.          this._bindingsByDestination = {};
  83.          this._bindingsBeginWithWord = {};
  84.          super();
  85.          mx_internal::_document = this;
  86.          this.percentWidth = 100;
  87.          this.height = 20;
  88.       }
  89.       
  90.       public static function set watcherSetupUtil(param1:IWatcherSetupUtil) : void
  91.       {
  92.          InstalledAppItemRenderer._watcherSetupUtil = param1;
  93.       }
  94.       
  95.       public function set iconImage(param1:Image) : void
  96.       {
  97.          var _loc2_:Object = this._1410965406iconImage;
  98.          if(_loc2_ !== param1)
  99.          {
  100.             this._1410965406iconImage = param1;
  101.             this.dispatchEvent(PropertyChangeEvent.createUpdateEvent(this,"iconImage",_loc2_,param1));
  102.          }
  103.       }
  104.       
  105.       override public function initialize() : void
  106.       {
  107.          var target:InstalledAppItemRenderer = null;
  108.          var watcherSetupUtilClass:Object = null;
  109.          mx_internal::setDocumentDescriptor(this._documentDescriptor_);
  110.          var bindings:Array = this._InstalledAppItemRenderer_bindingsSetup();
  111.          var watchers:Array = [];
  112.          target = this;
  113.          if(_watcherSetupUtil == null)
  114.          {
  115.             watcherSetupUtilClass = getDefinitionByName("_InstalledAppItemRendererWatcherSetupUtil");
  116.             watcherSetupUtilClass["init"](null);
  117.          }
  118.          _watcherSetupUtil.setup(this,function(param1:String):*
  119.          {
  120.             return target[param1];
  121.          },bindings,watchers);
  122.          var i:uint = 0;
  123.          while(i < bindings.length)
  124.          {
  125.             Binding(bindings[i]).execute();
  126.             i++;
  127.          }
  128.          mx_internal::_bindings = mx_internal::_bindings.concat(bindings);
  129.          mx_internal::_watchers = mx_internal::_watchers.concat(watchers);
  130.          super.initialize();
  131.       }
  132.       
  133.       [Bindable(event="propertyChange")]
  134.       public function get appLabel() : Label
  135.       {
  136.          return this._1149714771appLabel;
  137.       }
  138.       
  139.       override public function set data(param1:Object) : void
  140.       {
  141.          var _loc2_:String = null;
  142.          var _loc4_:String = null;
  143.          super.data = param1;
  144.          if(!param1)
  145.          {
  146.             return;
  147.          }
  148.          this.appLabel.text = param1.name;
  149.          var _loc3_:Array = [param1.icons["image16x16"],param1.icons["image32x32"],param1.icons["image48x48"],param1.icons["image128x128"]];
  150.          for each(_loc4_ in _loc3_)
  151.          {
  152.             if(_loc4_)
  153.             {
  154.                _loc2_ = _loc4_;
  155.                break;
  156.             }
  157.          }
  158.          if(!_loc2_)
  159.          {
  160.             this.iconImage.source = this.defaultIcon;
  161.          }
  162.          else
  163.          {
  164.             this.iconImage.source = "file://" + _loc2_;
  165.          }
  166.       }
  167.       
  168.       private function _InstalledAppItemRenderer_bindingExprs() : void
  169.       {
  170.          var _loc1_:* = undefined;
  171.          _loc1_ = this.defaultIcon;
  172.          _loc1_ = ProgrammaticSkin;
  173.       }
  174.       
  175.       [Bindable(event="propertyChange")]
  176.       private function get defaultIcon() : Class
  177.       {
  178.          return this._437289382defaultIcon;
  179.       }
  180.       
  181.       [Bindable(event="propertyChange")]
  182.       public function get iconImage() : Image
  183.       {
  184.          return this._1410965406iconImage;
  185.       }
  186.       
  187.       public function set appLabel(param1:Label) : void
  188.       {
  189.          var _loc2_:Object = this._1149714771appLabel;
  190.          if(_loc2_ !== param1)
  191.          {
  192.             this._1149714771appLabel = param1;
  193.             this.dispatchEvent(PropertyChangeEvent.createUpdateEvent(this,"appLabel",_loc2_,param1));
  194.          }
  195.       }
  196.       
  197.       private function _InstalledAppItemRenderer_bindingsSetup() : Array
  198.       {
  199.          var binding:Binding = null;
  200.          var result:Array = [];
  201.          binding = new Binding(this,function():Class
  202.          {
  203.             return defaultIcon;
  204.          },function(param1:Class):void
  205.          {
  206.             iconImage.setStyle("brokenImageSkin",param1);
  207.          },"iconImage.brokenImageSkin");
  208.          result[0] = binding;
  209.          binding = new Binding(this,function():Class
  210.          {
  211.             return ProgrammaticSkin;
  212.          },function(param1:Class):void
  213.          {
  214.             iconImage.setStyle("brokenImageBorderSkin",param1);
  215.          },"iconImage.brokenImageBorderSkin");
  216.          result[1] = binding;
  217.          return result;
  218.       }
  219.       
  220.       private function set defaultIcon(param1:Class) : void
  221.       {
  222.          var _loc2_:Object = this._437289382defaultIcon;
  223.          if(_loc2_ !== param1)
  224.          {
  225.             this._437289382defaultIcon = param1;
  226.             this.dispatchEvent(PropertyChangeEvent.createUpdateEvent(this,"defaultIcon",_loc2_,param1));
  227.          }
  228.       }
  229.    }
  230. }
  231.